package cn.serenedream.housedecoration.dao;

import cn.serenedream.housedecoration.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface UserRepository extends JpaRepository<User, Long> {
    @Query(value = "SELECT * FROM user WHERE name LIKE CONCAT('%', :name, '%')", nativeQuery = true)
    Page<User> findByName(@Param("name") String name, Pageable pageable);
}
